package msg

import (
	. "data/datatype"
)

const (
	DBMSG_BASE = 11000 + iota
	DBMSG_SAVE_OBJECT
	DBMSG_SAVE_CHILD_OBJECT
)

const (
	DBMSG_BAK_BASE = 12000 + iota
	DBMSG_SAVE_OBJECT_BAK
	DBMSG_SAVE_CHILD_OBJECT_BAK
)

type PropData struct {
	Name string
	Type string
	Val  interface{}
}

type Objects struct {
	Type    string
	Props   []PropData
	Records []Record
}

type Record struct {
	Name    string
	Rows    int
	Cols    int
	ColType []string
	ColData []interface{}
}

type DbPack struct {
	Dbid int64
	Data []Objects
}

type DBMsg struct {
	BaseMsg
}

type SaveObject struct {
	BaseMsg
	ObjId ObjectID
	Data  DbPack
}

type SaveObjectBak struct {
	BaseMsg
	ObjectID ObjectID
	DBID     int64
}

type SaveChildObject struct {
	BaseMsg
	ObjId     ObjectID
	Parent_id int64
	Data      DbPack
}

type SaveChildObjectBak struct {
	BaseMsg
	ObjId ObjectID
	DBID  int64
}
